home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #2 / Ham Radio 2000 - Volume 2.iso / HAMV2 / TCP_IP / TNOS230S / KISSDUMP.C < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-29  |  1.8 KB  |  86 lines

  1. /* Tracing routines for KISS TNC
  2.  * Copyright 1991 Phil Karn, KA9Q
  3.  *
  4.  * Modified by G1EMM  19/11/90 to support multiport KISS mode.
  5.  */
  6.  
  7. #include "global.h"
  8. #include "mbuf.h"
  9. #include "kiss.h"
  10. #include "devparam.h"
  11. #include "trace.h"
  12.  
  13. #if !defined(_lint)
  14. static char rcsid[] OPTIONAL = "$Id: kissdump.c,v 1.10 1996/08/29 12:11:16 root Exp root $";
  15. #endif
  16.  
  17.  
  18. void
  19. ki_dump (fp, bpp, check)
  20. FILE *fp;
  21. struct mbuf **bpp;
  22. int check;
  23. {
  24. int type, t;
  25. int val;
  26.  
  27.     traceprintf (fp, "KISS: ");
  28.     type = PULLCHAR(bpp);
  29.     t = type & 0x0f;
  30.     if (t == PARAM_DATA || t == PARAM_CRCREQ)    {
  31.         traceprintf (fp, "Port %d Data\n", type >> 4);  /*lint !e702 */
  32.         ax25_dump (fp, bpp, check);
  33.         return;
  34.     }
  35.     if (type == PARAM_RETURN)    {
  36.         traceprintf (fp, "RETURN\n");
  37.         return;
  38.     } else
  39.         traceprintf (fp, "Port %d ", type >> 4);    /*lint !e702 */
  40.  
  41.     val = PULLCHAR(bpp);
  42.     switch (type & 0x0f)    {
  43.         case PARAM_TXDELAY:
  44.             traceprintf (fp, "TX Delay: %lu ms\n", val * 10L);
  45.             break;
  46.         case PARAM_PERSIST:
  47.             traceprintf (fp, "Persistence: %u/256\n", val + 1);
  48.             break;
  49.         case PARAM_SLOTTIME:
  50.             traceprintf (fp, "Slot time: %lu ms\n", val * 10L);
  51.             break;
  52.         case PARAM_TXTAIL:
  53.             traceprintf (fp, "TX Tail time: %lu ms\n", val * 10L);
  54.             break;
  55.         case PARAM_FULLDUP:
  56.             traceprintf (fp, "Duplex: %s\n", (val == 0) ? "Half" : "Full");
  57.             break;
  58.         case PARAM_HW:
  59.             traceprintf (fp, "Hardware %u\n", val);
  60.             break;
  61.             case PARAM_POLL:
  62.             traceprintf (fp, "Poll\n");
  63.             break;
  64.         default:
  65.             traceprintf (fp, "code %u arg %u\n", type, val);
  66.             break;
  67.     }
  68. }
  69.  
  70.  
  71. int
  72. ki_forus (iface, bp)
  73. struct iface *iface;
  74. struct mbuf *bp;
  75. {
  76. struct mbuf *bpp;
  77. int i;
  78.  
  79.     if ((bp->data[0] & 0x0f) != PARAM_DATA)
  80.         return 0;
  81.     (void) dup_p (&bpp, bp, 1, AXALEN);
  82.     i = ax_forus (iface, bpp);
  83.     free_p (bpp);
  84.     return i;
  85. }
  86.